﻿@inject IDataCacheService _dataCacheService

@if (Model.Any())
{
    <CnGalWebSite.Components.Containers.MasaTitleContainer Icon="@IconType.Edit.ToIconString()" Title="待审核编辑" Class="mb-4" Collapable Outline>

        @foreach (var item in Model.Skip((CurrentPage - 1) * MaxCount).Take(MaxCount))
        {

            <div class="mb-4">
                <ExamineCard Model="item" />

            </div>
        }

        @if (TotalPages > 1)
        {
            <CnGalWebSite.Components.Paginations.MasaPagination Value="@CurrentPage" Length="@TotalPages" ValueChanged="OnPageClick" />
        }

    </CnGalWebSite.Components.Containers.MasaTitleContainer>
}


@code {
    [Parameter]
    public List<ExaminedNormalListModel> Model { get; set; } = new List<ExaminedNormalListModel>();

    public StringNumber TabIndex { get; set; } = 1;

    public int MaxCount { get; set; } = 10;

    public int TotalPages => ((Model.Count - 1) / MaxCount) + 1;

    public int CurrentPage { get; set; } = 1;


    private void OnPageClick(int pageIndex)
    {
        CurrentPage = pageIndex;
        StateHasChanged();
        
    }
}
